package com.zsl.service;


import com.zsl.model.Product;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class ProductServiceTestor {


    /**
     *  0.使用注解的形式完成 缓存下增删改成 -crud
     *  1.RedisTemplate
     *  2.不定查询
     * */

    @Autowired
     private ProductService productService;


    @Test
    public void testFineOne(){

        Product product = productService.getSingle(6L);

        System.out.println(product);

        Product product2 = productService.getSingle(3L);

        System.out.println(product2);

    }


    @Test
    public  void testRemove(){

        System.out.println(productService.remove(2L));


    }


    @Test
    public void testSave(){

         Product product = new Product();
         product.setProductId(3L);
         product.setName("test");

        System.out.println(productService.edit(product));
    }

}
